﻿@using KRM.Core
@model List<KRM.Core.Task>
@{
    ViewBag.Title = "ApproveTasks";
    Layout = "~/Views/Shared/_Layout.cshtml";
    var description = ViewBag.description;
    string dateFrom = ViewBag.dateFrom==null?"":ViewBag.dateFrom.ToString("MM/dd/yyyy");
    string dateTo = ViewBag.dateTo==null?"":ViewBag.dateTo.ToString("MM/dd/yyyy");
}
<script src="/js/task.js"></script>
<div class="container-fluid">
    <div class="box">
        <div class="box-title">
        <h3><i class="icon-tasks"></i>Pending Tasks</h3>
        </div>
        <div class="row-fluid">
            <form action="/task/approvetask" method="POST" id = "frApproveTask">
                <div id="ApproveTask" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
            </form>
            @Html.Partial("Partial/_MessageResult")
            <form action="/task/pendingtasks" style="margin:0" class="form-inline nomargin span4 " style="padding-bottom: 10px;">
                <input name="Description" class="input-large" type="text" placeholder="Description" value="@description">
                <button type="submit" class="btn btn-primary">Search</button>
            </form>
            <form action="/task/pendingtasks" class="left form-inline nomargin span7 " style="padding-bottom: 10px;">
                <div id="datetimepicker2" class="input-append">
                    <input data-format="MM/dd/yyyy" type="text" name="dateFrom" placeholder="From" value="@dateFrom"required="required"/>
                    <span class="add-on">
                        <i data-time-icon="icon-time" data-date-icon="icon-calendar" class="icon-calendar"></i>
                    </span>
                </div>
                <div id="datetimepicker3" class="input-append">
                    <input data-format="MM/dd/yyyy" type="text" name="dateTo"  placeholder="To" value="@dateTo" required="required"/>
                    <span class="add-on">
                        <i data-time-icon="icon-time" data-date-icon="icon-calendar" class="icon-calendar"></i>
                    </span>
                </div>
                <button type="submit" class="btn btn-primary">Search</button>
            </form>
            <a  type="button" class="btn btn-primary " href="/task/PendingTasks"> Clear</a>
        </div>
        <div class="row-fluid">
            <table class="table table-hover table-bordered table-fix dataTable">
                <thead>
                    <tr>
                        <th>TaskID</th>
                        <th>Description</th>
                        <th>Date Created</th>
                        <th>Approve</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var item in Model)
                    {
                        <tr>
                            <td>@item.TaskID</td>
                            <td style="text-align: left"> <div style="Max-height: 300px;max-width: 1000px;overflow: auto;">@Html.Raw(@item.TaskDescription.Replace(Environment.NewLine,"<br/>"))</div></td>
                            <td>@item.AssignedDate</td>
                            <td> <a href="#ApproveTask" role="button" data-toggle="modal"  class="" onclick="ViewTaskApprove(@item.TaskID)">Approve Task</a></td>
                        </tr>
                    }
                </tbody>
            </table>
        </div>
    </div>
</div>

